<template>
  <div class="common-search-form-component">
    <a-form :model="queryParams">
      <a-row :gutter="16">
        <a-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
          <a-form-item :label="$t('dept.name')">
            <a-input
              v-model:value="queryParams.name"
              :placeholder="$t('dept.searchPlaceholder')"
              allow-clear
              @pressEnter="handleSearch"
            />
          </a-form-item>
        </a-col>
        
        <a-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
          <a-form-item :label="$t('dept.status')">
            <a-select
              v-model:value="queryParams.status"
              :placeholder="$t('dept.statusPlaceholder')"
              allow-clear
            >
              <a-select-option :value="0">{{ $t('common.disabled') }}</a-select-option>
              <a-select-option :value="1">{{ $t('common.enabled') }}</a-select-option>
            </a-select>
          </a-form-item>
        </a-col>
      </a-row>
    </a-form>
  </div>
</template>

<script lang="ts" setup>

defineOptions({
  name: 'DeptSearchForm'
})

withDefaults(defineProps<{
  queryParams: {
    name: string
    status: 0 | 1 | undefined
  }
}>(), {
  queryParams: () => ({
    name: '',
    status: undefined
  })
})

// 组件事件
const emit = defineEmits<{
  (e: 'search'): void
}>()

// 搜索处理
const handleSearch = () => {
  emit('search')
}

</script>

<style lang="scss" scoped>
@import '@/assets/styles/views/common.scss';
</style> 